<template>
  <template v-for="menu1 in menuList">
    <el-submenu
      v-if="menu1.children && menu1.children.length"
      :index="menu1.id"
      :key="menu1.id"
    >
      <template #title>
        <i v-if="menu1.icon" :class="menu1.icon" />
        <span>{{ menu1.title }}</span>
      </template>
      <submenu-list :menuList="menu1.children" />
    </el-submenu>
    <el-menu-item
      v-else
      :index="menu1.id"
      :key="menu1.id"
      :route="item.path"
    >
      <i v-if="menu1.icon" :class="menu1.icon" />
      <template #title>{{ menu1.title }}</template>
    </el-menu-item>
  </template>
</template>

<script>
import { defineComponent } from "vue";
export default defineComponent({
  name: "SubmenuList",
  props: {
    menuList: {
      type: Array,
      default: () => [],
    },
  },
});
</script>